package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.ClientTransfer;
import cn.wolfcode.crm.mapper.ClientTransferMapper;
import cn.wolfcode.crm.query.ClientTransferQueryObject;
import cn.wolfcode.crm.query.PageResult;
import cn.wolfcode.crm.service.IClientTransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClientTransferServiceImpl implements IClientTransferService{


    @Autowired
    private ClientTransferMapper mapper;

    public void insert(ClientTransfer record) {
        mapper.insert( record );
    }

    public ClientTransfer selectByPrimaryKey(Long id) {

        return mapper.selectByPrimaryKey(id);
    }

    public PageResult query(ClientTransferQueryObject qo) {

        int total = mapper.queryForCount(qo);
        if(total > 0){
            List<ClientTransfer> rows = mapper.queryForList(qo);
            return new PageResult(rows, total);
        }
        return new PageResult();
    }
}
